What is the use of the Users panel in the mIRC Editor? You might have been wondering all this time. Their use is finally explained here. You store there the access levels of users identified by their nick, ident and IP number. Now you may ask what an access level is. So far we have used the wildcard (*) access level in all our scripts. Which means that anyone can make your mIRC respond to that event definition. With the use of Access Levels you can restrict mIRC to respond to an event to only certain people. These certain people you list in the Users panel.
Users scripts have two components: The Access level value and authentication entry. The later is more important than the former. In the Authentication entry you specify how the user will be identified as belonging to a particular level. The Access level value you can put anything according to conveniences.
The format for entry in a Users script is:
(Access level):(nick)!(ident)@(ip number).
Example:
5:AgentSmith!agent@matrix.com
Now let's say you want mIRC to message "Yes!" to only a certain group of people when they say "Hey!" in a channel. You could write a Remote script with universal access which will check if
$nick is one of those and respond accordingly:
on *:text:Hey!:#: {
if (($nick == nick1) || ($nick == nick2) || ($nick == nick3) || ($nick == nick4) || ($nick == nick5)) {
msg $nick Yes!
}
}
Now how do you know if the nick which messaged "Hey!" in the channel is the authentic owner of that particular nick? Even if the nick is registered with NickServ and enforced one can use it for a brief period of time. And what if services are down? An impostor can easily get the better of you and your script.
In a situation like this you can use the Users script. It offers various levels of authentication according to your entry in the Users file. From authentication by nick only to authentication by nick, ident and IP number of the person. We create a few fictitious entries in the Users script to show how they work.
5:nick1!blink@210.214.34.6
5:nick2!*@*
5:nick3!*@202.209.43.56
2,5:nick4!*@*
2,5,10:nick5!power@mirc.com
10:nick6!oper@mirc.com
2:nick7!power@*
The Users entry is explained below:
nick1 has an Access level of 5 and it will be authenticated only if it's ident is "blink" and IP number 210.214.34.6
nick2 too has an Access level of 5 and it's authenticated using only it's nick.
nick3 will be authenticated if it's IP number is 202.209.43.56 irrespective of the ident. And it to has got an Access level of 5.
nick4 has an Access level of 2 and 5 and it's nick is the only requirement to authenticate itself.
nick5 has got Access levels of 2, 5 and 10. It will be authenticated only if it's ident is "power" and hostname mirc.com
nick6 has an Access level of 10 and authenticated by it's ident "oper" and hostname mirc.com
nick7 is authenticated if it's ident is "power". And it's Access level is 2.
Now we will rewrite the script which we wrote using the universal Access level with an Access level of 5 so that only nick1, nick2, nick3, nick4 and nick5 which have got the Access level of 5 can invoke it. The event definition will be invisible to the rest of the people.
on 5:text:Hey!:#: {
msg $nick Yes!
}
Now it looks a lot neater, doesn't it? If you change the Access level to 2 only nick2, nick5 and nick7 can invoke the script. Similarly if you want to create a group which only can invoke a certain response you assign them similar Access levels and specify the Access level in the event definition.
The story of Access levels doesn't end here. I personally don't encourage using Access levels so I won't be dealing with it any further. If you want to know more about them the mIRC Help File is always there for you and it's well documented there.
Positive points about using Access Levels:
1). They tidy up the code when it comes to identifying a number of nicks as a group.
2). They provide a reasonably reliable authentication system.
Negative points about using Access Levels:
1). Can't be easily used to distribute your scripts to others. Requires quite an extra amount of coding to do it.
2). If using an Access level higher than 1, the event definition can't be used to process events by ordinary users. Using another
Remote script for ordinary users can clash with the one with Access levels.
3). Using Access levels to authenticate the user to deal with channel/nick management or remote access to mIRC poses a VERY
BIG security risk. User identity can be spoofed in many ways.
You can always do without Users scripts. Infact I have never used them and don't think I will be using them even in future. I can't let a script identify and authenticate a nick, I prefer to do it myself. For the untidy looking group identification Remote script with a universal Access level, you can use Tokens to tidy it up. Tokens are covered in the tutorial on Advanced mIRC Scripting. That's all on Access levels from my side.
At this point we have covered all the important topics on mIRC scripting for a beginner. Now you should be able to write your own scripts and make sense of many scripts available online. If you want to be a good scripter, you should keep scripting and also study scripts written by other people. Now that you have learnt a lot about mIRC scripting, how about some
Scripting Tips?
Back
|
Table of Contents
Copyright © 2002-2004 SpyderWares.
Feel free to distribute this tutorial in part or whole, just make sure the credits stay intact.
http://spyderwares.com